request('"'getstr(100, 'OK')'"' getstr(7, 'Could not save config file!'))
END
RETURN 0
LoadConfig:
IF OPEN('fh', 'S:ImageConvert.cfg', 'R') THEN DO
IF READLN('fh')=='ImageConvert' THEN DO
appmode=READLN('fh')
reqmode=READLN('fh')
destformat=READLN('fh')
destw=READLN('fh')
desth=READLN('fh')
destcolors=READLN('fh')
END
CLOSE('fh')
END
ELSE DO
appmode='PPaint'
reqmode='opus'
destformat='ILBM'
destw=640
desth=480
destcolors=128
END
RETURN 0
ConfigDialog:
/* should I ask the user? */
destc=destcolors
IF destcolors=16777216 THEN destc='16M'
/* destw=0 --> do not alter resolution! */
IF destw~=0 THEN DO
resolution=destw' x 'desth
END
ELSE DO
resolution=getstr(210, 'As before')
END
res=request('"'getstr(102, 'Yes') || '|' || getstr(103, 'No') || '|' || getstr(101, 'Cancel')'"' getstr(200, 'Do you want to convert the image(s) as follows:') || lf || appmode' 'getstr(201, 'to')' 'UPPER(destformat)':'resolution' x 'destc'?')
IF res=0 THEN EXIT
/* ask the user */
IF res=2 THEN DO
/* reqmode */
IF reqtools=1 & opus=1 THEN DO
res=request('"DOpus|ReqTools|' || getstr(101, 'Cancel')'"' getstr(209, 'Which kind of requesters do you like?'))
IF res=0 THEN EXIT
IF res=1 THEN reqmode='opus'
IF res=2 THEN reqmode='reqtools'
END
/* appmode */
res=request('"ArtEffect|Photogenics2|PPaint|' || getstr(101, 'Cancel')'"' getstr(202, 'Which application do you want to use?'))
IF res=0 THEN EXIT
IF res=1 THEN appmode='ArtEffect'
IF res=2 THEN appmode='Photogenics2'
IF res=3 THEN appmode='PPaint'
/* image format */
formats='ILBM|JPEG|PNG|GIF|'
IF appmode=='PPaint' THEN formats='ILBM|PNG|GIF|'
IF appmode=='ArtEffect' THEN formats='ILBM|JPEG|PNG|'
IF appmode=='Photogenics2' THEN formats='JPEG|PNG|GIF|'
res=request('"'formats || getstr(101, 'Cancel')'"' getstr(206, 'Which formats should the converted image(s) have?'))
IF res=0 THEN EXIT
IF appmode=='PPaint' & res>1 THEN res=res+1
IF appmode=='Photogenics2' THEN res=res+1
IF res=1 THEN destformat='ilbm'
IF res=2 THEN destformat='jpeg'
IF res=3 THEN destformat='png'
IF res=4 THEN destformat='gif'
/* resolution */
resw.1=640 ; resh.1=256
resw.2=640 ; resh.2=480
resw.3=800 ; resh.3=600
resw.4=1024 ; resh.4=768
resw.5=1280 ; resh.5=1024
res=request('"640x256|640x480|800x600|1024x768|1280x1024|'getstr(210, 'As before')'|'getstr(204, 'Custom')'|'getstr(101, 'Cancel')'"' getstr(203, 'Which resolution do you want to use?'))
IF res=0 THEN EXIT
IF res=7 THEN DO
DO UNTIL destw>0
destw=numberrequest(getstr(100, 'OK') || '|' || getstr(101, 'Cancel') destw getstr(207, 'How wide should the converted image(s) be (in pixel)?'))
IF destw=-1 THEN EXIT
END
DO UNTIL desth>0
desth=numberrequest(getstr(100, 'OK') || '|' || getstr(101, 'Cancel') desth getstr(208, 'How high should the converted image(s) be (in pixel)?'))
IF desth=-1 THEN EXIT
END
END
ELSE IF res=6 THEN DO
destw=0
END
ELSE DO
destw=resw.res
desth=resh.res
END
/* # of colors */
destcolors=16777216
IF appmode~=='ArtEffect' & destformat~=='jpeg' THEN DO
colors='2|4|8|16|32|64|128|256|16M|'
IF appmode=='PPaint' THEN colors='2|4|8|16|32|64|128|256|'
destdepth=request('"'colors || getstr(101, 'Cancel')'"' getstr(205, 'How many colors should the converted image(s) have?'))